package me.aartikov.alligator.commands;


import me.aartikov.alligator.OhosNavigator;
import me.aartikov.alligator.util.Log;
import me.aartikov.alligator.Screen;
import me.aartikov.alligator.animations.AnimationData;
import me.aartikov.alligator.destinations.AbilityDestination;
import me.aartikov.alligator.destinations.DialogFragmentDestination;
import me.aartikov.alligator.destinations.FragmentDestination;
import me.aartikov.alligator.exceptions.NavigationException;
import me.aartikov.alligator.navigators.AbilityNavigator;
import me.aartikov.alligator.navigators.DialogFragmentNavigator;
import me.aartikov.alligator.navigators.FragmentNavigator;

/**
 * Command implementation for {@code goForward} method of {@link OhosNavigator}.
 */
public class ForwardCommand extends BaseCommand {
    private Screen mScreen;

    private AnimationData mAnimationData;

    public ForwardCommand(Screen screen, AnimationData animationData) {
        super(screen.getClass());
        mScreen = screen;
        mAnimationData = animationData;
    }

    @Override
    protected boolean executeForActivity(AbilityDestination destination, AbilityNavigator activityNavigator) throws NavigationException {
        Log.i("ForwardCommand.executeForActivity([destination, activityNavigator]):31");
        return activityNavigator.goForward(mScreen, destination, mAnimationData);
    }

    @Override
    protected boolean executeForFragment(FragmentDestination destination, FragmentNavigator fragmentNavigator) throws NavigationException {
        return fragmentNavigator.goForward(mScreen, destination, mAnimationData);
    }

    @Override
    protected void executeForDialogFragment(DialogFragmentDestination destination, DialogFragmentNavigator dialogFragmentNavigator) throws NavigationException {
        dialogFragmentNavigator.goForward(mScreen, destination, mAnimationData);
    }
}
